<template>
    <div ref="dom" class="charts chart-radar"></div>
</template>
<script>
import echarts from 'echarts'
import tdTheme from './theme.json'
import { on, off } from '@/libs/tools'
echarts.registerTheme('tdTheme', tdTheme)
export default {
  name: 'ChartScatter',
  props: {
    value: Object,
    text: String,
    subtext: String,
  },
  data () {
    return {
      dom: null
    }
  },
  methods: {
    resize () {
      this.dom.resize()
    }
  },
  mounted () {
    this.$nextTick(() => {
// let data = this.value.data;

// let option=this.value.option;
     console.log(this.value);

      this.dom = echarts.init(this.$refs.dom, 'tdTheme')
      this.dom.setOption(this.value.option)
      on(window, 'resize', this.resize)
    })
  },
  beforeDestroy () {
    off(window, 'resize', this.resize)
  }
}
</script>
